package com.wc.alorithm_blue_bridge._数学知识.组合数.小蓝的MEX问题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/16 11:44
 * @description https://www.lanqiao.cn/problems/18528/learning/?contest_id=191
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010, P = 998244353;
    static long[] mul = new long[N];
    static long[] mulx = new long[N];
    static long[] base = new long[N];
    static int[] a = new int[N];
    static int n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            int x = sc.nextInt();
            a[x]++;
        }

        mulx[N - 1] = 1;
        base[0] = 1;
        for (int i = 1; i < N; i++) base[i] = (base[i - 1] << 1) % P;

        for (int i = N - 2; i >= 0; i--) {
            mulx[i] = mulx[i + 1] * base[a[i + 1]] % P;
        }
        if (a[0] > 0) mul[0] = 1;
        for (int i = 1; i < N; i++) {
            mul[i] = mul[i - 1] * (base[a[i - 1]] - 1) % P;
        }

        while (m-- > 0) {
            int x = sc.nextInt();
            // 注意非空集合
            if (x == 0) out.println(mulx[x] - 1);
            else out.println(mul[x] * mulx[x] % P);
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}